﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="true" CodeFile="recObjectionResponse.aspx.cs" Inherits="lists_Transaction_recObjectionResponse" %>

<asp:Content ID="Content1" ContentPlaceHolderID="body" Runat="Server">

<link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    
    <div>
    <button id="btnAdd" type="button" onclick="OpenForm('add');">
        Tambah</button>
    <button id="btnEdit" type="button" onclick="OpenForm('edit');">
        Ubah</button>
    
    </div>
    
    <br />
    <br />
    <table id="table" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pager" class="scroll">
    </div>
    <div id="dialog" title="Default dialog">
    </div>
    
    <script type="text/javascript">
        $("#btnAdd").button({ icons: { primary: "ui-icon-plus"} });
        $("#btnEdit").button({ icons: { primary: "ui-icon-pencil"} });
    </script>
    
    <script type="text/javascript">
        var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Transaction/recObjectionHandler.ashx") %>';
        $('#table').jqGrid({
            url: handlerUrl + '?method=getdata',
            datatype: 'json',
            colNames: ['Debitur', 'No Surat', 'Tanggal Surat', 'No. Sanksi', 'Tanggal Sanksi', 'Nilai Sanksi', 'Nilai Keberatan', 'Id Transaksi', 'No. STS', 'Tgl. STS', 'Catatan', 'Status', 'File STS'],
            colModel: [
            //{ name: 'ObjectionID', hidden: true, index: 'ObjectionID', align: 'left', width: 100 },
                    {name: 'DebiturName', index: 'DebiturName', align: 'center', width: 100 },
                    { name: 'ObjectionNo', index: 'ObjectionNo', align: 'center', width: 100 },
                    { name: 'ObjectionDate', index: 'ObjectionDate', align: 'left', width: 100, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                    { name: 'SanctionNo', index: 'SanctionNo', align: 'left', width: 100 },
                    { name: 'SanctionDate', index: 'SanctionDate', align: 'left', width: 150, formatter: 'date', formatoptions: { newformat: 'd M Y'} },
                    { name: 'SanctionValue', index: 'SanctionValue', align: 'Left', width: 150 },
                    { name: 'ObjectionValue', index: 'ObjectionValue', align: 'Left', width: 150 },
                    { name: 'TransNo', index: 'TransNO', align: 'Left', width: 250 },
                    { name: 'ResponNo', index: 'ResponNO', align: 'Left', width: 250 },
                    { name: 'ResponDate', index: 'ResponDate', align: 'Left', width: 250 },
                    { name: 'ResponNote', index: 'ResponNote', align: 'Left', width: 100 },
                    { name: 'TransStatus', index: 'TransStatus', align: 'Left', width: 150 },
                    { name: 'ResponFile', index: 'ResponFile', align: 'center', width: 50, search: false }

           	],
            rowNum: 10,
            id: 'ObjectionID',
            multiselect: true,
            rowList: [5, 10, 15, 20],
            pager: '#pager',
            sortname: 'recObjection.ObjectionID',
            sortorder: "asc",
            viewrecords: true,
            jsonReader: { repeatitems: false },
            width: 1250,
            height: '100%',
            caption: 'Permohonan Keberatan',
            ajaxGridOptions: { cache: false },
            ondblClickRow: function () {
                OpenForm('edit');
            }
        });

        $("#table").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, searchtext: 'Search', refreshtext: 'Refresh' },
        {}, {}, {}, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true });

        function OpenForm(ctl) {

            var formUrl = '<%= ResolveUrl("~/forms/Transaction/recObjectionForm.aspx") %>';
            //            var formUrl1 = '<%= ResolveUrl("~/forms/transaction/recPaymentLoadRekKoranform.aspx") %>';
            //            var formUrl2 = '<%= ResolveUrl("~/forms/transaction/recPaymentAutoRekonsiliasiform.aspx") %>';
            //            var formUrl3 = '<%= ResolveUrl("~/forms/transaction/recPaymentUpdateform.aspx") %>';
            var grid = $('#table');
            var selIds = grid.jqGrid('getGridParam', 'selarrrow'),
                selText = [];
            //            $.each(selIds, function () {
            //                selText.push(grid.jqGrid('getCell', this, 'PaymentID'));
            //            });



            if (ctl == 'edit') {
                if (selIds.length == 0) {
                    alert('Pilih data yang mau di ubah !');
                }
                else if (selIds.length > 1) {
                    alert('Pilih satu record untuk ubah data.');
                }
                else {
                    $('#dialog').load(formUrl).dialog({ autoOpen: false, modal: true, width: 450, title: 'Ubah Keberatan' });
                    $("#dialog").dialog('open');
                }
            }
            else if (ctl == 'add') {
                $('#dialog').load(formUrl).dialog({ autoOpen: false, modal: true, width: 450, title: 'Tambah Keberatan' });
                $("#dialog").dialog('open');
            }

            else {

                if (selIds.length == 0)
                    alert('Pilih data yang mau di hapus !');
                else {
                    var result = window.confirm('Benar data akan di hapus ?');
                    if (result) {

                        var objrecPayment = new Object();
                        //                        objrecPayment.PaymentID = encodeURIComponent(selText);
                        //                        jsonData = JSON.stringify(objrecPayment);
                        //                        CallAjax('<%= ResolveUrl("~/ajaxhandler/transaction/recPaymenthandler.ashx") %>', "?method=delete", jsonData);
                        //                        setTimeout("$('#table').trigger('reloadGrid');", 3000);
                    }
                }

            }
        }
        
    </script>
    <br />
    <br />
    <br />
    <br />
</asp:Content>

